#include "ReadWriteLock.h"

ReadWriteLock::ReadWriteLock(void)
{
    pthread_rwlock_init(&m_rwlock, NULL);
}

ReadWriteLock::~ReadWriteLock(void)
{
    pthread_rwlock_destroy(&m_rwlock);
}

int ReadWriteLock::ReadLock()
{
    return pthread_rwlock_rdlock(&m_rwlock);
}

int ReadWriteLock::TryReadLock()
{
    return pthread_rwlock_tryrdlock(&m_rwlock);
}

int ReadWriteLock::WriteLock()
{
    return pthread_rwlock_wrlock(&m_rwlock);
}

int ReadWriteLock::TryWriteLock()
{
    return pthread_rwlock_wrlock(&m_rwlock);
}

int ReadWriteLock::Unlock()
{
    return pthread_rwlock_unlock(&m_rwlock);
}




